//by k1 2022.2.19

if (isNil "kk_fog_loop") then {
	kk_fog_loop = 1;
	if (isServer) then {
		save_fog_tmp2 = fog;
		_fog = random 1;
		if(_fog < .3)then{_fog = .3};
		30 setFog _fog; //
	};
	if (isDedicated) then [{
		waitUntil {!kk_fog_mass};
	},{
		_pos = position player;
		_ps = "#particlesource" createVehicleLocal _pos;
		_ps setParticleRandom [3, [80, 80, 0], [0, 0, 0], 2, .5, [0, 0, 0, .1], 0, 0];
		_ps setParticleCircle [.1, [0, 0, 0]]; //40
		_ps setDropInterval .01;
		_i = 0;
		_t = 0;
		_veh2 = objNull;
		waitUntil {
			if (time > _t) then {
				_uavControl = (UAVControl (getConnectedUAV player)) select 1;
				_veh = if(_uavControl == "")then[{vehicle player},{getConnectedUAV player}];
				if (_i == 0) then {_i = 1; _veh2 = _veh; _ps setParticleParams [["\A3\data_f\ParticleEffects\Universal\universal.p3d" , 16, 12, 13, 0], "", "Billboard", 1, 10, [0, 0, -6], [0, 0, 0], 1, 1.275, 1, 0, [4], [[1, 1, 1, 0], [1, 1, 1, .04], [1, 1, 1, 0]], [1000], 1, 0, "", "", _veh]};
				if (_veh != _veh2) then {_i = 0};
				_t = time + 1;
			};
			!kk_fog_mass
		};
		deleteVehicle _ps;
	}];
	if (isServer) then {3 setFog save_fog_tmp2};
	kk_fog_loop = nil;
};


